﻿using Sidvall.Serialization;

namespace Sidvall.IdentityManager.Data.Keys
{
    public class EmailIndex
    {
        public string Email { get; set; }
        
        public static EmailIndex GetKey(IAspNetUsers item)
        {
            if (item == null)
                return null;
            if (item.Email == null)
                return null;
            return new EmailIndex()
            {
                Email = item.Email,
            };
        }
        public static EmailIndex GetKey(string email)
        {
            if (email == null)
                return null;
            return new EmailIndex()
            {
                Email = email,
            };
        }
        public static EmailIndex ParseKey(string key)
        {
            return new EmailIndex()
            {
                Email = key,
            };
        }
        public override string ToString()
        {
            return this.Email;
        }
    }
}